﻿using System;
using System.Collections.Generic;

namespace Socium.Domain.Documents {
	[Serializable]
	public class Document {
		public ICollection<Person> Persons {
			get { return _persons; }
		}

		public ICollection<RelationGroup> Criterias {
			get { return _criterias; }
		}

		public ICollection<Relation> Relations {
			get { return _relations; }
		}

		public ICollection<Sociogram> Sociograms {
			get { return _sociograms; }
		}

		public ICollection<Sociomatrix> Sociomatrices {
			get { return _sociomatrices; }
		}

		readonly ICollection<Person> _persons = new LinkedList<Person>();
		readonly ICollection<Sociogram> _sociograms = new LinkedList<Sociogram>();
		readonly ICollection<Sociomatrix> _sociomatrices = new LinkedList<Sociomatrix>();
		readonly ICollection<RelationGroup> _criterias = new LinkedList<RelationGroup>();
		readonly ICollection<Relation> _relations = new LinkedList<Relation>();

		public void Save(string path) {
			Serializer.Save(path, this);
		}

		public static Document Load(string path) {
			return Serializer.Load<Document>(path);
		}
	}
}
